package com.ztmg.water.controller.water;

import com.ztmg.common.util.resultUtils.JsonResult;;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageInfo;


import com.ztmg.water.vo.water.WaterBrandVO;
import com.ztmg.water.dto.water.WaterBrandDTO;
import com.ztmg.water.dto.water.WaterBrandPageDTO;
import com.ztmg.water.service.water.WaterBrandService;

import java.util.List;


/**
 * 
 * WaterBrandControllerController
 * 
 **/

@Api(description = "桶装水品牌接口")
@RestController
@RequestMapping(value = "/waterBrand")
public class WaterBrandController{

	@Resource
	private WaterBrandService waterBrandService;

    @PostMapping("selectCountWaterBrand")
    @ApiOperation("水品牌数量")
    public JsonResult selectCountWaterBrand(@RequestBody WaterBrandDTO dto){
        return waterBrandService.selectCountWaterBrand(dto);
    }

    @PostMapping("create")
    @ApiOperation("新增")
    public JsonResult create(@RequestBody WaterBrandDTO dto){
        return waterBrandService.create(dto);
    }

    @PostMapping("update")
    @ApiOperation("修改")
    public JsonResult update(@RequestBody WaterBrandDTO dto){
        return waterBrandService.update(dto);
    }

    @GetMapping("detail/{id}")
    @ApiOperation("详情")
    public JsonResult<WaterBrandVO> detail(@PathVariable Integer id){
        return waterBrandService.selectById(id);
    }

    @PostMapping("select")
    @ApiOperation("条件查询")
    public JsonResult<List<WaterBrandVO>> detail(@RequestBody WaterBrandDTO dto){
        return waterBrandService.select(dto);
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<WaterBrandVO>> queryPage(@RequestBody WaterBrandPageDTO dto){
        return waterBrandService.selectPage(dto);
    }

    @PostMapping("delete")
    @ApiOperation("条件删除")
    public JsonResult delete(@RequestBody WaterBrandDTO dto){
        return waterBrandService.delete(dto);
    }

    @GetMapping("deleteById/{id}")
    @ApiOperation("删除")
    public JsonResult deleteById(@PathVariable Integer id){
        return waterBrandService.deleteById(id);
    }

}